<?php
$this->breadcrumbs=array(
	'Articles',
);

$this->menu=array(
	array('label'=>'Create Article', 'url'=>array('create')),
	array('label'=>'Manage Article', 'url'=>array('admin')),
);


?>
<script language="javascript">
$(function(){

	$("#product-statistics").css({"height":"120px","overflow":"hidden"});
	
	$("#product-show").toggle(function(){
		$("#product-statistics").css({"height":"auto"}).fadeIn('show');
	},function(){
		$("#product-statistics").css({"height":"120px","overflow":"hidden"});
	});
	
	$("input[type=checkbox]").click(function(){
		alert($(this).val());
	});

	$(".achiveremove").click(function(){
		var href = $(this).attr("href");
		var object = $(this);
		$.post(href,function(data){
			if(data == 'ok'){
				object.parent().parent().parent().slideUp();
			}
		});
		return false;
	});
	

	
	$(".achiveview").hover(function(){
		$(this).find(".achive-action").show();
	},function(){
		$(this).find(".achive-action").hide();
	});
});

function updateView(id){
	
	var url = '<?php echo $this->createUrl('comment/itemview');?>';

	url = url.replace(/<?php echo Yii::app()->urlManager->urlSuffix;?>/,'/id/'+id+'<?php echo Yii::app()->urlManager->urlSuffix;?>');

	
//	alert(url);
//	$.get(url,function(msg){
//		alert(msg);
//	});
	
	$("#reply-"+id).load(url);
}
function actionResourceIsComment(object){

	var id = object.attr("id");
	var ac = object.attr("name");

	//alert(id+'-'+ac);
	
	$.post('<?php echo $this->createUrl('comment/batchresource'); ?>',{'id':id,'ac':ac},function(data){
		//alert(data);

		updateView(id);

		if(data == 0){
		    $.msgbox({
		        height:100,
		        width:250,
		        content:{type:'alert', content: '修改成功！'},
		        animation:4,
		        onClose:function(){
					
		        }
		    });
		}	
	});

	
}
</script>

<div class="column1 colborder">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('admin','Statistics'),	));?>
			
				<div>文章 (<?php echo CHtml::link($statistics['total'],array('list'));?>) |页面 (<?php $page = Article::model()->getNewsStatistics(Category::CONTENT_PAGE); echo CHtml::link($page['total'],array('news/list','ctype'=>Category::CONTENT_PAGE));?>) |    已发布 (<?php echo CHtml::link($statistics['published'],array('list','state'=>Article::STATUS_PUBLISHED));?>) |   锁定(<?php echo CHtml::link($statistics['lock'],array('list','state'=>Article::STATUS_LOCK));?>) |    草稿 (<?php echo CHtml::link($statistics['draft'],array('list','state'=>Article::STATUS_DRIFT));?>) | 存档文件(<?php echo CHtml::link($statistics['achive'],array('achive'));?>) | 回收站 (<?php echo CHtml::link($statistics['lock'],array('list','state'=>Article::STATUS_TRASH));?>)	</div>
				<div class="box-content">
					<ul id="product-statistics">
					<?php foreach ($catelist as $cate):?>
						<?php $this->renderPartial('_list',array('data'=>$cate));?>
					<?php endforeach;?>		
					</ul>
					<div style="text-align: right;"><a id="product-show" href="javascript:void();">显示所有分类</a></div>
				</div>
				
		<?php $this->endWidget();?>
	</div>
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('article','Achives'),	));?>
			<div class="box-content">
				<?php foreach ($achive as $data): ?>
					<?php $this->renderPartial('_achiveview',array('data'=>$data));?>
				<?php endforeach;?>
			</div>	
		<?php $this->endWidget();?>
	</div>

</div>
<div class="column2">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('article','Latest Updates'),	));?>
	 		<div class="box-content">
				<?php $this->widget('application.components.latest.Latest',array(
						'limit'=>5,
						'timeFormat'=>'Y-m-d h:i:s',
						'htmlOptions'=>array(
							'style'=>"text-align:center;"
						)
				));?> 		
	 		</div>
		<?php $this->endWidget();?>	
	</div>	
	
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('article','Article Tags'),	));?>
	 		<div class="box-content">
				<?php echo $tags;?>		
	 		</div>
		<?php $this->endWidget();?>	
	</div>	
			
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('admin','Comments')));?>
			<div class="box-content">
				<?php foreach ($comments as $data): ?>
					<?php $this->renderPartial('/comment/_list',array('data'=>$data));?>
				<?php endforeach;?>
				<hr class="space" />
			</div>	
		<?php $this->endWidget();?>
	</div>
	
</div>

<?php $this->widget('ext.box.colorbox.colorboxWidget',array(
		'id'=>'td a',
		'options'=>'width:"95%", height:"95%", iframe:true'
))?>
